package com.dream.keigezhushou.Activity.kege.acty;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.dream.keigezhushou.Activity.Uiutils.UiUtils;
import com.dream.keigezhushou.Activity.kege.adapter.ChorusListAdapter;
import com.dream.keigezhushou.R;
import com.handmark.pulltorefresh.library.PullToRefreshListView;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 合唱列表
 */
public class ChorusListActivity extends AppCompatActivity {
    @BindView(R.id.iv_return)
    ImageView ivReturn;
    @BindView(R.id.tv_title)
    TextView tvTitle;

    @BindView(R.id.list_lv)
    PullToRefreshListView mMPullToRefreshListView;
    private ListView mListlv;
    private View mHeadView;
    private ChorusListAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chorus_list);
        ButterKnife.bind(this);
        initView();
    }


    //初始化控件
    public void initView() {
        tvTitle.setText("合唱列表");
        adapter = new ChorusListAdapter(ChorusListActivity.this);
        mListlv = mMPullToRefreshListView.getRefreshableView();

        mHeadView = UiUtils.inflateView(R.layout.head_chorus_list);
        mListlv.addHeaderView(mHeadView);
        mListlv.setAdapter(adapter);

        adapter.setItemOnClickListening(new ChorusListAdapter.ItemOnClickListening() {
            @Override
            public void itemClick(int postion) {
                finish();
            }
        });


        ivReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }
}
